package com.example.lanouhn.bantangapp.activities.adapters;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.lanouhn.bantangapp.R;
import java.util.List;

/**
 * Created by lanouhn on 16/7/19.
 */
public class Adapter_Search_history extends RecyclerView.Adapter<Adapter_Search_history.MyViewHolder> {
    private Context context;
    List<String> keyWordStrList ;

    public Adapter_Search_history(Context context, List<String> keyWordStrList) {
        this.context = context;
        this.keyWordStrList = keyWordStrList;

    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.search_history_item,null);
        MyViewHolder viewHolder = new MyViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder( MyViewHolder holder, int position) {

        holder.tv_history.setText(keyWordStrList.get(position));

    }

    @Override
    public int getItemCount() {
        return keyWordStrList.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder{

        private TextView  tv_history;

        public MyViewHolder(View itemView) {
            super(itemView);
            tv_history= (TextView) itemView.findViewById(R.id.tv_history);


        }
    }
}
